package com.bwie.controller;

import com.bwie.pojo.Order;
import com.bwie.pojo.Prod;
import com.bwie.service.OrderService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import com.bwie.vo.PageOrderVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * description:
 *
 * @Author chentong
 * @Create 2025/5/6 19:21
 * @Version 1.0
 */
@RestController
@RequestMapping("/order/order")
public class OrderController {

    @Autowired
    OrderService orderService;

    /**
     * 订单分页列表查询
     * @param pageOrderVo
     * @return
     */
    @ApiOperation(value = "订单分页列表查询")
    @PostMapping("/orderList")
    public R orderList(@RequestBody PageOrderVo pageOrderVo){
        return orderService.orderList(pageOrderVo);
    }


    /**
     * 下订单（添加商品）
     * @param prodList
     * @return
     */
    @ApiOperation(value = "下订单")
    @PostMapping("/addOrder")
    public R addOrder(@RequestBody List<Prod> prodList){
        return orderService.addOrder(prodList);
    }

}
